package Structure.array;

import java.util.Arrays;

/**
 * @author wang'ji'cheng
 * @date 2025/7/26
 */
public class ArrayDemo2 {
    public static void main(String[] args) {

        int[] arr = {1, 2, 3, 4, 5};
        int sum = 0;
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i]);
            sum += arr[i];
        }
        System.out.println(sum);

        int[] arr1 = {1,2,3,4,5,6,7,8,9,10};
        int count = 0;
        for (int i = 0; i < arr1.length; i++) {
            if(arr1[i]%3==0){
                count++;
            }
        }
        System.out.println(count);

        int[] arr2={1,2,3,4,5,6,7,8,9,10};
        for (int i = 0; i < arr2.length; i++) {
            if(arr2[i]%2==1){
                arr2[i]*=2;
            }else {
                arr2[i]/=2;
            }
        }
        System.out.println(Arrays.toString(arr2));
    }

}
